import java.util.Scanner;

public class Day_22_1_小易升级之路 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            int n = scan.nextInt();
            int a = scan.nextInt();
            while(n > 0) {
                int b = scan.nextInt();
                if(a > b) {
                    a += b;
                }else {
                    a += gbc(b,a);
                }
                n--;
            }
            System.out.println(a);
        }

    }
    public static int gbc(int a, int b) {
        return a % b == 0 ? b : gbc(b,a%b);
    }
}
